# coding=utf-8
from aip import AipOcr
from datetime import datetime
# AppID
# API Key
# Secret Key
# 包名
# sw4
# 18268607
# qwzaUW2z6NgjVNNlKYiXgPpXCs75lIXTx8WWGRuIWxf1ghnNYugQ3E0L
# 文字识别
# 不需要

# 还是比较准确的，赞
APPP_ID = '18268607'
API_KEY = 'qwzaUW2z6NgjVNNlKYiXgPpX'
SECRET_KEY = 'Cs75lIXTx8WWGRuIWxf1ghnNYugQ3E0L'

client = AipOcr(APPP_ID, API_KEY, SECRET_KEY)

a = datetime.now()
i = open(r'3.png', 'rb')

img = i.read()

message = client.basicGeneral(img)
print("message:"+ str(message))

for msg in message.get('words_result'):
    print(msg.get('words'))

b = datetime.now()  # 获取当前时间
durn = (b-a).seconds  #两个时间差，并以秒显示出来
print("user time second: %d" % durn)
